package com.order.domain.pojo;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * 订单表
 * </p>
 *
 * @author 小杰大人
 * @since 2025-09-29
 */
@Getter
@Setter
@ToString
@TableName("`order`")
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Order implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 订单ID
     */
    @TableId("id")
    private Long id;

    /**
     * 订单编号
     */
    @TableField("order_no")
    private String orderNo;

    /**
     * 用户ID
     */
    @TableField("user_id")
    private Long userId;

    /**
     * 订单标题
     */
    @TableField("subject")
    private String subject;


    /**
     * 订单总金额
     */
    @TableField("total_amount")
    private BigDecimal totalAmount;

    /**
     * 实际支付金额
     */
    @TableField("pay_amount")
    private BigDecimal payAmount;

    /**
     * 支付方式 1:支付宝 2:微信
     */
    @TableField("payment_type")
    private Byte paymentType;

    /**
     * 支付时间
     */
    @TableField("payment_time")
    private LocalDateTime paymentTime;

    /**
     * 支付流水号
     */
    @TableField("payment_serial_number")
    private Long paymentSerialNumber;

    /**
     * 订单状态 1:待支付 2:已支付 3:已完成 4:已取消 5:已退款
     */
    @TableField("status")
    private Byte status;

    /**
     * 订单备注
     */
    @TableField("remark")
    private String remark;

    @ApiModelProperty("创建时间")
    @TableField(value = "create_time" , fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @ApiModelProperty("订单超时时间")
    @TableField(value = "time_out")
    private LocalDateTime timeOut;

    @ApiModelProperty("更新时间")
    @TableField(value = "update_time" , fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;


    @ApiModelProperty("创建人")
    @TableField(value = "create_user" , fill = FieldFill.INSERT)
    private Long createUser;

    @ApiModelProperty("修改人")
    @TableField(value = "update_user" , fill = FieldFill.INSERT_UPDATE)
    private Long updateUser;

    /**
     * 是否删除 0:否 1:是
     */
    @TableField("deleted")
    private Byte deleted;
}
